package com.ruoyi.system.service.aggregation.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.aggregation.Card;
import com.ruoyi.system.mapper.aggregation.CardMapper;
import com.ruoyi.system.service.aggregation.ICardService;

/**
 * 银行卡Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-01
 */
@Service
public class CardServiceImpl implements ICardService 
{
    @Autowired
    private CardMapper cardMapper;

    @Override
    public Card selectCardById(Long id)
    {
        return cardMapper.selectCardById(id);
    }

    @Override
    public Card selectCardByUserId(Long userId)
    {
        return cardMapper.selectCardByUserId(userId);
    }

    @Override
    public int insertCard(Card card)
    {
        card.setCreateTime(DateUtils.getNowDate());
        card.setDeleted(0);
        return cardMapper.insertCard(card);
    }

    @Override
    public int updateCard(Card card)
    {
        card.setUpdateTime(DateUtils.getNowDate());
        return cardMapper.updateCard(card);
    }

    @Override
    public int deleteCardById(Long id)
    {
        return cardMapper.deleteCardById(id);
    }
}

